//
//  UserInfoManager.swift
//  GreatART
//
//  Created by zhangheng on 2018/4/11.
//  Copyright © 2018年 www.Dayishu.com. All rights reserved.
//

import Foundation
//import SwiftProgressHUD

class UserInfoManager: NSObject {
    
    public static let shared = UserInfoManager()
    
    /////////////////////////////////////////////////////////////////////////////
    
     var isLogin: Bool? {
        get {return UserDefaults.standard.bool(forKey: "USER_isLogin")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_isLogin")
            UserDefaults.standard.synchronize()
        }
    }
    
    var memid: String?{
        get {return UserDefaults.standard.string(forKey: "USER_ID_memid")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_ID_memid")
            UserDefaults.standard.synchronize()
        }
    }
    
    var checkCode: String?{
        get {return UserDefaults.standard.string(forKey: "USER_checkCode")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_checkCode")
            UserDefaults.standard.synchronize()
        }
    }
    var photo: String?{
        get {return UserDefaults.standard.string(forKey: "USER_photo")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_photo")
            UserDefaults.standard.synchronize()
        }
    }
    
    
    var activity_name: String?{
        get {return UserDefaults.standard.string(forKey: "USER_activity_name")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_activity_name")
            UserDefaults.standard.synchronize()
        }
    }
    var order_time:String?{
        get {return UserDefaults.standard.string(forKey: "USER_order_time")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_order_time")
            UserDefaults.standard.synchronize()
        }
    }
    
    var kPassword: String?{
        get {return UserDefaults.standard.string(forKey: "USER_kPassword")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_kPassword")
            UserDefaults.standard.synchronize()
        }
    }
    
    
    var lastNotice: String?{
        get {return UserDefaults.standard.string(forKey: "USER_lastNotice")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_lastNotice")
            UserDefaults.standard.synchronize()
        }
    }
    
    
    var roomId: String?{
        get {return UserDefaults.standard.string(forKey: "USER_roomId")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_roomId")
            UserDefaults.standard.synchronize()
        }
    }
    
    var ownidKey: String?{
        get {return UserDefaults.standard.string(forKey: "USER_ownidKey")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_ownidKey")
            UserDefaults.standard.synchronize()
        }
    }
    
    var ownid: String?{
        get {return UserDefaults.standard.string(forKey: "USER_ownid")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_ownid")
            UserDefaults.standard.synchronize()
        }
    }
    
    var hostId: String?{
        get {return UserDefaults.standard.string(forKey: "USER_hostId")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_hostId")
            UserDefaults.standard.synchronize()
        }
    }
    
    
    var zak: String?{
        get {return UserDefaults.standard.string(forKey: "USER_zak")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_zak")
            UserDefaults.standard.synchronize()
        }
    }
    
    var token: String?{
        get {return UserDefaults.standard.string(forKey: "USER_token")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_token")
            UserDefaults.standard.synchronize()
        }
    }
    
    
    var userId: String?{
        get {return UserDefaults.standard.string(forKey: "USER_userId")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_userId")
            UserDefaults.standard.synchronize()
        }
    }
    
    var time: String?{
        get {return UserDefaults.standard.string(forKey: "USER_time_g")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_time_g")
            UserDefaults.standard.synchronize()
        }
    }
    
    var disname: String?{
        get {return UserDefaults.standard.string(forKey: "USER_disname")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_disname")
            UserDefaults.standard.synchronize()
        }
    }
    
    var onVideo: Bool? {
        get {return UserDefaults.standard.bool(forKey: "USER_onVideo")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_onVideo")
            UserDefaults.standard.synchronize()
        }
    }
    
    var onAudio: Bool? {
        get {return UserDefaults.standard.bool(forKey: "USER_onAudio")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_onAudio")
            UserDefaults.standard.synchronize()
        }
    }
    
    
    var lang: String?{
        get {return UserDefaults.standard.string(forKey: "USER_lang")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_lang")
            UserDefaults.standard.synchronize()
        }
    }
    
    //数据初始化
    var LiveURL: String?{
        get {return UserDefaults.standard.string(forKey: "USER_URL_LiveURL")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_URL_LiveURL")
            UserDefaults.standard.synchronize()
        }
    }
    var LiveToken: String?{
        get {return UserDefaults.standard.string(forKey: "USER_URL_LiveToken")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_URL_LiveToken")
            UserDefaults.standard.synchronize()
        }
    }
    
    var PlayUrl: String?{
        get {return UserDefaults.standard.string(forKey: "USER_URL_PlayUrl")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_URL_PlayUrl")
            UserDefaults.standard.synchronize()
        }
    }
    
    var LiveTitle: String?{
        get {return UserDefaults.standard.string(forKey: "USER_LIVE_TITLE")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_LIVE_TITLE")
            UserDefaults.standard.synchronize()
        }
    }
    
  
    var isJoin: Bool? {
        get {return UserDefaults.standard.bool(forKey: "USER_isJoin")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_isJoin")
            UserDefaults.standard.synchronize()
        }
    }
    
    var isOnLive: Bool? {
        get {return UserDefaults.standard.bool(forKey: "USER_ISONLIVE")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_ISONLIVE")
            UserDefaults.standard.synchronize()
        }
    }
    
    var isOnRecord: Bool? {
        get {return UserDefaults.standard.bool(forKey: "USER_ISONRECORD")}
        set {
            UserDefaults.standard.set(newValue, forKey: "USER_ISONRECORD")
            UserDefaults.standard.synchronize()
        }
    }
    
    
    func removeForKey(key:String) -> (){
        UserDefaults.standard.removeObject(forKey: key)
        UserDefaults.standard.synchronize()
    }
}

